package com.itkaien.javaeebased.multipleSystem;

import java.util.concurrent.Callable;
import java.util.concurrent.locks.ReentrantLock;

public class Work08ThreadExcutor implements Callable {
    int max=0;
   ReentrantLock lock=  new ReentrantLock();
    @Override
    public Integer call() throws Exception {

        for (int i = 0; i < 100; i++) {
            try {
                lock.lock();
                if (max<i) {
                    max=i;
                }
                System.out.println("Work08ThreadExcutor:"+Thread.currentThread().getName() + i);
            } finally {
                lock.unlock();
            }
        }

        return max;
    }
}
